﻿/*
 * Copyright (c) 2000-2015 Tacke Consulting, Inc
 * 
 * Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated 
 * documentation files (the "Software"), to deal in the Software without restriction, including without limitation 
 * the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 
 * and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
 * 
 * The above copyright notice and this permission notice shall be included in all copies or substantial portions 
 * of the Software.
 * 
 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED 
 * TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 
 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF 
 * CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER 
 * DEALINGS IN THE SOFTWARE.
 * 
 */
using System;

using System.Collections.Generic;
using System.Text;
using System.Runtime.InteropServices;

namespace OpenNETCF.Media.DirectShow
{
    /// <summary>
    /// The IReferenceClock interface represents a system reference clock. The DirectMusic master clock and a port's 
    /// latency clock implement this interface.
    /// </summary>
    [ComImport]
    [Guid("56A86897-0AD4-11CE-B03A-0020AF0BA770")]
    [InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
    internal interface IReferenceClock
    {
        /// <summary>This method retrieves the current time.</summary>
        /// <returns>Current time.</returns>
        ulong GetTime();

        /// <summary>This method requests an asynchronous notification that a duration has elapsed.</summary>
        /// <param name="rtBaseTime">Base reference time.</param>
        /// <param name="rtStreamTime">Stream offset time.</param>
        /// <param name="hEvent">Handle of an event through which to advise.</param>
        /// <returns>Destination of the token.</returns>
        int AdviseTime([In] ulong rtBaseTime, [In] ulong rtStreamTime, [In] IntPtr hEvent);

        /// <summary>This method requests an asynchronous, periodic notification that a duration has elapsed.</summary>
        /// <param name="rtStartTime">Time that the notification should begin.</param>
        /// <param name="rtPeriodTime">Period of time between notifications.</param>
        /// <param name="hSemaphore">Handle of a semaphore through which to advise.</param>
        /// <returns>Identifier of the request.</returns>
        int AdvisePeriodic([In] ulong rtStartTime, [In] ulong rtPeriodTime, [In] IntPtr hSemaphore);

        /// <summary>This method cancels a request for notification. </summary>
        /// <param name="dwAdviseCookie">
        /// Identifier of the request that is to be canceled, as set in the IReferenceClock::AdviseTime or 
        /// the IReferenceClock::AdvisePeriodic method. 
        /// </param>
        void Unadvise([In] uint dwAdviseCookie);
    }
}
